// 根路径
const baseURL = 'http://203.2.113.31:30006'
// url为请求的路径，method为请求方式，data为要携带的参数，header为请求头，timeout为请求时间
const request = (o) => {
	let options = {
		url: '',
		method: 'GET',
		data: {},
		header: {},
        // 微信小程序请求时间一般设置为60000
		timeout: 60000
	}
	Object.assign(options, o)
	return new Promise((resolve, reject) => {
		uni.request({
			url: baseURL + '/' + options.url,
			method: options.method,
			data: options.data,
			header: options.header,
			timeout: options.timeout,
			success(res) {
				resolve(res)
			},
			fail(err) {
				reject(err)
			}
 
		})
	})
}
export default request
